/*
 * create:2016年4月16日 下午12:44:29
 * author:wangds  
 */
package net.wangds.comp.endpoint.http.proc;

import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;

import net.wangds.common.processor.AbstractInputOutputProcessor;
import net.wangds.precasting.processor.io.InputStreamReadAsBytesProcessor;

/**
 * .
 * @author wangds
 *
 */
public class ReadPostBodyAsBytesProcessor extends AbstractInputOutputProcessor<HttpServletRequest, byte[]>{

  /*
   * @see net.wangds.common.processor.AbstractInputOutputProcessor#process(java.lang.Object)
   * @author wangds 2016年4月16日 下午1:01:46.
   */
  @Override
  protected byte[] process(HttpServletRequest req) throws Exception {
    ServletInputStream is = req.getInputStream();
    InputStreamReadAsBytesProcessor proc = new InputStreamReadAsBytesProcessor();
    proc.setInputStream(is);
    proc.process();
    return proc.getResult();
  }

}
